import Vue from 'vue'
import Vuex from 'vuex'

import home from './modules/home'
import theme from './modules/theme'
import list from './modules/list'
import search from './modules/search'
import goods from './modules/goods'
import category from './modules/category'
import ad from './modules/ad'

Vue.use(Vuex)

const debug = process.env.NODE_ENV !== 'production'

export default new Vuex.Store({
    state: {
        title: ''
    },
    actions: {
        async setTitle({ commit }, title) {
            commit('fillTitle', title)
        }
    },
    getters: {},
    mutations: {
        fillTitle: function (state, title) {
            state.title = title
        }
    },
    modules: {
        home,
        theme,
        list,
        search,
        goods,
        category,
        ad
    },
    strict: debug
})
